<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
		<title>设置答题状态</title>
		<link rel="stylesheet" href="__PUBLIC__/css/weui.min.css" />
		<link rel="stylesheet" href="__PUBLIC__/css/example.css" />
		<script src="__PUBLIC__/js/zepto.min.js"></script>
		<script src="__PUBLIC__/js/jquery-weui.js"></script>
		<script src="__PUBLIC__/js/jquery.min.js"></script>
		<style type="text/css">
			.progerss{
				margin-left: 40px;
			}
		</style>
	</head>

	<body>
		<div class="container">

			<div class="hd">
				<h1 class="page_title">设置答题状态</h1>
			</div>
			<div class="bd">

				<div class="weui_cells_title">试题开启</div>
				<?php if(is_array($stateInfo)): foreach($stateInfo as $key=>$stateInfo): ?><div class="weui_cells weui_cells_form">
						<div class="weui_cell">
							<div class="weui_cell_hd">
								<label class="weui_label">
									<span id="state"><?php echo ($stateInfo["state"]); ?></span>
									<?php if($stateInfo["state"] == '开启'): ?><input type="checkbox" checked="checked"/>
    									<?php else: ?><input type="checkbox"/><?php endif; ?>
									<label style="display: none;"><?php echo ($stateInfo["class"]); ?></label>
								</label>
							</div>
							<div class="weui_cell_bd weui_cell_primary">
								<label><?php echo ($stateInfo["class"]); ?></label>
								<label class="progerss">进度：34/56</label>
							</div>
							<div class="weui_cell_ft">
							</div>
						</div>
					</div><?php endforeach; endif; ?>
			</div>
		</div>
	</body>
	<script type="text/javascript">
		$(":checkbox").click(function(){
   			var state = $(this).siblings('#state').text();
			url = "<?php echo U('ClassTest/handleTestState');?>";
			banji = $(this).siblings('label').html();
			if(state == "关闭"){
				$(this).siblings('#state').text('开启');
			   	data = {
			   		state:"开启",
			   		quizName:"<?php echo ($stateInfo["quizName"]); ?>",
			   		banji:banji
			   	}
			   	$.post(url,data,
			   	function(data,status){
			   	});
			}else{
				$(this).siblings('#state').text('关闭');
				data = {
			   		state:"关闭",
			   		quizName:"<?php echo ($stateInfo["quizName"]); ?>",
			   		banji:banji
			   	}
			   	$.post(url,data,
			   	function(data,status){
			   	});
			}
		});
		$(".progerss").click('click', function(){
			var banji = $(this).siblings().html();
			alert(banji);
			window.location.href="showUnsubmit";
		});
	</script>
</html>